import { DataBlocker, DataProxy } from "../A-LIB/sources/lib.b.data";

class Status {
	/** 当前的时间 */
	curr_time: number;
}

const blocker: DataBlocker<Status> = {
	get: {
		curr_time(proxy, value) {
			return value ?? Date.now();
		},
	}
}

const proxy_map = new Map<string, Status>();

export default function get_proxy(prefix?: string){
	prefix = prefix??'';
	if(!proxy_map.has(prefix)){
		proxy_map.set(prefix, DataProxy.initProxy('global_status', new Status(), false, blocker, prefix));
	}
	return proxy_map.get(prefix);
}
